﻿using ErrorOr;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gym.Domain.Common.EventualConsistency
{
    public class EventualConsistencyException : Exception
    {
        public Error EventualConsistencyError { get; }
        public List<Error> UnderlyingErrors { get; }

        public EventualConsistencyException(
            Error eventualConsistencyError,
            List<Error>? underlyingErrors = null) : base(message: eventualConsistencyError.Description)
        {
            EventualConsistencyError = eventualConsistencyError;
            UnderlyingErrors = underlyingErrors ?? new();
        }
    }
}
